GdkPixbufAnimation *animation;
GIcon *gicon;
GtkIconSet *icon_set;
- gchar *icon_name;
gchar *stock_id;
cairo_surface_t *orig_surface;
self->priv->icon_set = NULL;
}
- g_clear_pointer (&self->priv->icon_name, g_free);
g_clear_pointer (&self->priv->stock_id, g_free);
self->priv->storage_type = GTK_IMAGE_EMPTY;
}
static void
-ensure_pixbuf_for_icon_name_or_gicon (GtkIconHelper *self,
- GtkStyleContext *context)
+ensure_pixbuf_for_gicon (GtkIconHelper *self,
+ GtkStyleContext *context)
{
GtkIconTheme *icon_theme;
gint width, height;
ensure_icon_size (self, context, &width, &height);
- if (self->priv->storage_type == GTK_IMAGE_ICON_NAME &&
- self->priv->icon_name != NULL)
- {
- info = gtk_icon_theme_lookup_icon (icon_theme,
- self->priv->icon_name,
- MIN (width, height), flags);
- }
- else if (self->priv->storage_type == GTK_IMAGE_GICON &&
- self->priv->gicon != NULL)
+ if (self->priv->gicon != NULL)
{
info = gtk_icon_theme_lookup_by_gicon (icon_theme,
self->priv->gicon,
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:
- ensure_pixbuf_for_icon_name_or_gicon (self, context);
+ ensure_pixbuf_for_gicon (self, context);
break;
case GTK_IMAGE_ANIMATION:
}
static void
-ensure_surface_for_icon_name_or_gicon (GtkIconHelper *self,
- GtkStyleContext *context)
+ensure_surface_for_gicon (GtkIconHelper *self,
+ GtkStyleContext *context)
{
GtkIconTheme *icon_theme;
gint width, height, scale;
ensure_icon_size (self, context, &width, &height);
scale = get_scale_factor (self, context);
- if (self->priv->storage_type == GTK_IMAGE_ICON_NAME &&
- self->priv->icon_name != NULL)
- {
- info = gtk_icon_theme_lookup_icon_for_scale (icon_theme,
- self->priv->icon_name,
- MIN (width, height),
- scale, flags);
- }
- else if (self->priv->storage_type == GTK_IMAGE_GICON &&
- self->priv->gicon != NULL)
+ if (self->priv->gicon != NULL)
{
info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme,
self->priv->gicon,
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:
- ensure_surface_for_icon_name_or_gicon (self, context);
+ ensure_surface_for_gicon (self, context);
break;
case GTK_IMAGE_ANIMATION:
icon_name[0] != '\0')
{
self->priv->storage_type = GTK_IMAGE_ICON_NAME;
- self->priv->icon_name = g_strdup (icon_name);
+ self->priv->gicon = g_themed_icon_new (icon_name);
_gtk_icon_helper_set_icon_size (self, icon_size);
}
}
const gchar *
_gtk_icon_helper_get_icon_name (GtkIconHelper *self)
{
- return self->priv->icon_name;
+ if (self->priv->storage_type != GTK_IMAGE_ICON_NAME)
+ return NULL;
+
+ return g_themed_icon_get_names (G_THEMED_ICON (self->priv->gicon))[0];
}
GtkIconHelper *